package jnpf.form;

import jnpf.base.ActionResult;
import jnpf.entity.FlowFormEntity;
import jnpf.exception.WorkFlowException;
import jnpf.form.fallback.FlowFormDataApiFallback;
import jnpf.model.flow.DataModel;
import jnpf.model.flow.FlowFormDataModel;
import jnpf.utils.FeignName;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = FeignName.FORM_SERVER_NAME, fallback = FlowFormDataApiFallback.class, path = "/FormData")
public interface FlowFormDataApi {

    @PostMapping("/saveOrUpdate")
    ActionResult saveOrUpdate(@RequestBody FlowFormDataModel flowFormDataModel);

    @PostMapping("/info")
    ActionResult info(@RequestBody FlowFormDataModel flowFormDataModel);

    /**
     * 获取表单流程引擎
     *
     * @param flowId
     * @return
     */
    @GetMapping("/getFlowIdList/{flowId}" )
    List<FlowFormEntity> getFlowIdList(@PathVariable("flowId" ) String flowId);

    /**
     * 更新功能表单关联流程id
     */
    @PostMapping("/updateForm" )
    void updateForm(@RequestBody FlowFormEntity model);

    /**
     * 流程引用表单保存
     *
     * @param flowId formIds
     * @return
     * @copyright 引迈信息技术有限公司
     * @date 2022/12/5
     */
    @PostMapping("/saveFlowIdByFormIds/{flowId}" )
    ActionResult saveFlowIdByFormIds(@PathVariable("flowId" ) String flowId, @RequestBody List<String> formIds);


    /**
     * 获取表单详情
     *
     * @param formId
     * @return FlowFormEntity
     * @copyright 引迈信息技术有限公司
     * @date 2022/12/5
     */
    @GetMapping("/getById/{formId}" )
    FlowFormEntity getById(@PathVariable("formId" ) String formId);

    /**
     * 修改或保存
     *
     * @param flowFormEntity
     * @copyright 引迈信息技术有限公司
     * @date 2022/12/5
     */
    @PostMapping("/form/saveOrUpdate" )
    ActionResult saveOrUpdate(@RequestBody FlowFormEntity flowFormEntity) throws WorkFlowException;

    @GetMapping("/remobeById" )
    void remobeById(@RequestParam("id" ) String id);

    @GetMapping("/saveLogicFlowAndForm" )
    void saveLogicFlowAndForm(@RequestParam("id" ) String id);

}
